package cn.xdmnb.cloud.blog.user.api.fallback;

import cn.xdmnb.cloud.blog.core.dict.ResultCode;
import cn.xdmnb.cloud.blog.core.model.ResultMsg;
import cn.xdmnb.cloud.blog.user.api.feign.UserFeign;
import cn.xdmnb.cloud.blog.user.po.SysRole;
import cn.xdmnb.cloud.blog.user.po.SysUser;
import cn.xdmnb.cloud.blog.user.po.SysUserConnection;
import cn.xdmnb.cloud.blog.user.req.SysBindReq;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author yukai
 * @since 2023年01月06日 00:31
 */
@Component
@Slf4j
public class UserFeignFallback implements UserFeign {
    @Override
    public ResultMsg<SysUser> getByUsername(String username) {
        log.error("User Server Fallback..........");
        return ResultMsg.resultFail(ResultCode.SERVER_FALLBACK.getCode(),ResultCode.SERVER_FALLBACK.getMsg());
    }

    @Override
    public ResultMsg<List<SysRole>> getRolesByUserId(Long userId) {
        log.error("User Server Fallback..........");
        return ResultMsg.resultFail(ResultCode.SERVER_FALLBACK.getCode(),ResultCode.SERVER_FALLBACK.getMsg());
    }

    @Override
    public ResultMsg<SysUser> getByUserId(String userId) {
        log.error("User Server Fallback..........");
        return ResultMsg.resultFail(ResultCode.SERVER_FALLBACK.getCode(),ResultCode.SERVER_FALLBACK.getMsg());
    }

    @Override
    public ResultMsg<List<SysUser>> listByUserId(List<String> userIds) {
        log.error("User Server Fallback..........");
        return ResultMsg.resultFail(ResultCode.SERVER_FALLBACK.getCode(),ResultCode.SERVER_FALLBACK.getMsg());
    }

    @Override
    public ResultMsg<SysUserConnection> getByProviderId(String providerId, String providerUserId) {
        log.error("User Server Fallback..........");
        return ResultMsg.resultFail(ResultCode.SERVER_FALLBACK.getCode(),ResultCode.SERVER_FALLBACK.getMsg());
    }

    @Override
    public ResultMsg<Void> bind(SysBindReq bindReq) {
        log.error("User Server Fallback..........");
        return ResultMsg.resultFail(ResultCode.SERVER_FALLBACK.getCode(),ResultCode.SERVER_FALLBACK.getMsg());
    }
}
